﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

/**
 * 成员属性膨胀：一千种商品就要准备一千种成员属性
 */
namespace BiliBiliCSharpStudy.ch30.d02 {
    class HelloGeneric2 {
        public static void Demo() {
            Test1();
        }
        public static void Test1() {
            Apple apple = new Apple() { Color = "Red" };
            Book book = new Book() { Name = "笑傲江湖" };
            Box box1 = new Box() { Apple = apple };
            Box box2 = new Box() { Book = book };
            Console.WriteLine(box1.Apple.Color);
            Console.WriteLine(box2.Book.Name);
        }
    }

    class Apple {
        public string Color { get; set; }
    }

    class Book {
        public string Name { get; set; }
    }
    class Box {
        public Apple Apple { get; set; }
        public Book Book { get; set; }
    }
}
